<%@page import="org.Help_Desk.Entity.Complain"%>
<%@page import="java.util.List"%>
<%@page import="org.Help_Desk.Entity.Employee"%>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"%>
<%@ page import="java.sql.*"%>
<%@ page import="java.io.*"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"  %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Complain Description</title>
</head>
<body>
    <% Employee emp=new Employee();
    System.out.println("here1");
                        List<String> pri=emp.fetchPriority();
                        List<String> compcat=emp.fetchCategory();
                        session.setAttribute("pri", pri);
                        session.setAttribute("compcat", compcat);
                        String compid=request.getParameter("compid");
                        System.out.println("Complain Id: "+compid);
                        List<Complain> comp=emp.fetchComplain(compid);
                        session.setAttribute("comp", comp);
                        System.out.println(comp.get(0).getDesc());
                        %>
	
	<form class="form-horizontal" method="post" action="employeeadd">
		<center>
			<h1>Problem Description</h1>
		</center>
		<table>
			<tr>
				<th>Complain ID</th>
				<th>Complain Title</th>
				<th>Complain Description</th>
				
			</tr>
                        
                        <c:forEach var="Comp" items="${ls}">  
                            <form class="form-horizontal" method="post" action="employee">
                    <tr>  
                        <td>  
                            ${comp.getCompid()}
                            
                            </td>
                            <input type="hidden" name="id" value="${comp.getCompid()}">
                            <td>
                            <c:out value="${comp.getTitle()}"></c:out>  
                            </td>
                            <td>
                            <c:out value="${comp.getDesc()}"></c:out>  
                            </td>
                            <tr>
			<td>Priority</td>
                                <td>      <select>
                                        <%									

						try 
                                                {
                                                    int i;
                                                    i=0;
                                                    while(i<=pri.size()-1)
                                                    {
                                                        %>
                                                        <option value="<%=pri.get(i)%>"><%=pri.get(i)%> </option> 
                                                    <% i++;}
                                                } catch (Exception e) {
						out.print(e);
                                                }
                                        %>
                                    </select></td>
				

			</tr> 
				
			<tr>
				<td>Category</td>
                                <td>      <select>
					<%									

						try 
                                                {
                                                    int i;
                                                    i=0;
                                                    while(i<=compcat.size()-1)
                                                    {
                                                        System.out.println(pri.get(i));
                                                        %>
                                                        <option value="<%=compcat.get(i)%>"><%=compcat.get(i)%> </option> 
                                                    <% i++;}
                                                } catch (Exception e) {
						out.print(e);
                                                }
                                        %>
                                    </select></td>
				
			</tr>
			<tr>
				
			</tr>
			<tr>
				<td><input type="Submit" Value="Add To Queue"></td>
				<td><input type="Submit" Value="Cancel"></td>
			</tr>
		</table>
	</form>
                        </c:forEach>
          </body>
</html>